<template>
  <el-dialog title="配置" :visible.sync="dialogVisible" @opened="dialogOpen">
    <el-form ref="form" :model="detail" label-width="80px" size="small">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item prop="name" label="名称">
              <el-input v-model="detail.name" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item prop="cade" label="编码">
              <el-input v-model="detail.code" readonly></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item prop="remark" label="流程">
          <!-- <el-input v-model="detail.remark"></el-input> -->
          <el-select v-model="detail.remark" clearable placeholder="请选择" style="width:100%;">
            <el-option
              v-for="(item, index) in options"
              :key="index"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-row>
      <el-form-item class="from-bnts">
        <el-button type="primary" @click="submit">保存</el-button>
        <el-button @click="close">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
  import utils from '@/assets/utils/zhzf-util';
  import dictCache from "@/assets/utils/cache-dict-util";
  import workflowApi from '@/api/system/workflow';
  import dictApi from "@/api/system/dict";
  export default {
    name: "workflow-set-info",
    props: {
      value: Boolean
    },
    data() {
      return {
        loading: false,
        dialogVisible: false,
        detail:{},
        options:[]
      };
    },
    watch: {
      value(val) {
        this.dialogVisible = val;
      },
      dialogVisible(val) {
        this.$emit("input", val);
      }
    },
    methods: {
      async initPage(detail){
        this.detail = detail;
        await this.getWorkflowData();
      },
      async getWorkflowData(){
        var tempArr = [
          {label:'道路行政', value:"simple_road_transport_handle,general_road_transport_handle"},
          {label:'港口行政', value:'simple_port_administration_handle,general_port_administration_handle'},
          {label:'公路路政', value:'simple_heightway_administration_handle,general_heightway_administration_handle'},
          {label:'海事行政', value:'simple__maritime_administration_handle,general_maritime_administration_handle'},
          {label:'航道行政', value:'simple_waterway_administration_handle,general_waterway_administration_handle'},
          {label:'水路运政', value:'simple_waterway_transport_handle,general_waterway_transport_handle'},
          {label:'工程质量安全监察', value:'simple_project_quality_supervision_handle,general_project_quality_supervision_handle'},
          {label:'其他', value:'simple_other_process_handle,general_other_process_handle'}
        ];
        this.options = tempArr;
      },
      submit() {
        this.$refs["form"].validate(async valid => {
          if (!valid) {
            return false;
          }
          this.loading = true;
          await dictApi.mod(this.detail);
          this.loading = false;
          this.dialogVisible = false;
          this.$emit("submit");
        });
      },
      close() {
        this.$refs["form"].resetFields();
        this.dialogVisible = false;
      },
      dialogOpen(){

      }
    }
  };
</script>